package com.xy.farm.activity.deal.adapter;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.xy.farm.R;
import com.xy.farm.activity.deal.ShelvesActivity;


/**
 * Created by 1174607250 on 2018/8/8.
 */

public class SelectGoodsAdapter extends RecyclerView.Adapter<SelectGoodsAdapter.ViewHolder>
{
    public class ViewHolder extends RecyclerView.ViewHolder
    {
        private LinearLayout onClick;
        public ViewHolder(View view)
        {
            super(view);
            onClick = view.findViewById(R.id.onClick);
        }
    }
    @Override
    public int getItemCount()
    {
        return 10;
    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
    {
        return new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item_select_goods, parent, false));
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, int position)
    {
        holder.onClick.setOnClickListener(new View.OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                Intent intent = new Intent(v.getContext(), ShelvesActivity.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                v.getContext().startActivity(intent);
            }
        });
    }
}
